home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Documentation / DirectX9 / directx9_c.chm / directx / code / legacymembers.js < prev    next >
Encoding:
Text File  |  2004-09-30  |  3.9 KB  |  135 lines

  1.  
  2. var gsTabControl="";
  3. var gaDivs = new Array();
  4.  
  5. function initTabbedMembers()
  6. {
  7.     var persistedTab=0;
  8.     divscol=document.all.tags("div");
  9.     divsize=divscol.length;
  10.     if (divsize>0)
  11.     {
  12.         gsTabControl='<TABLE id=tblTabbed style="BORDER-RIGHT: #99ccff 2px solid; BORDER-TOP: #99ccff 2px solid; BORDER-LEFT: #99ccff 2px solid; BORDER-BOTTOM: #99ccff 2px solid; cellSpacing: 0; cellPadding: 5; border=0"><TBODY><TR class=clsTab>'
  13.         for (var i=0;i<divsize;i++)
  14.         {
  15.             thisdiv=divscol.item(i);
  16.             if (thisdiv.tabName)
  17.             {
  18.                 gaDivs[gaDivs.length]=thisdiv;
  19.                 // peterril (01/16/01): resolved bug #19405, added keyboard accessibility support.
  20.                 gsTabControl=gsTabControl + '<TD onkeypress="tabToggle(this);" tabindex="0" onfocus="if(this.style.color!=\'black\') this.style.color=\'yellow\';" onblur="if(this.style.color==\'yellow\') this.style.color=\'white\';" title="' + thisdiv.tabName + '" class=clsTab id=' + thisdiv.tabName + ' style="BACKGROUND: #666666" onclick="tabToggle(this);"> ' +  thisdiv.tabName + ' </TD>'
  21.                 var sPTagSourceIndex=thisdiv.sourceIndex-1;
  22.                 document.all(sPTagSourceIndex).outerHTML="";
  23.             }
  24.         }
  25.         gsTabControl=gsTabControl + '</TR></TBODY></TABLE>'
  26.         if (document.all.item('expandoTabDiv'))
  27.         {
  28.             expandoTabDiv.insertAdjacentHTML("beforeBegin", gsTabControl);
  29.             if (oBD.doesPersistence)
  30.             {
  31.                 expandoTabDiv.addBehavior("#default#userData");
  32.                 expandoTabDiv.load(gsStoreName);
  33.                 persistedTab=expandoTabDiv.getAttribute("selectedTab")
  34.                 if (!persistedTab)
  35.                 {
  36.                     persistedTab=0;
  37.                 }
  38.             }
  39.             if (persistedTab >= gaDivs.length)
  40.             {
  41.                 persistedTab=0;
  42.             }
  43.             var tabId=gaDivs[persistedTab].tabName;
  44.             setColumnSizes();
  45.             tabToggle(tblTabbed.all(tabId));
  46.             var persistedScroll=expandoTabDiv.getAttribute("scroll")
  47.             expandoTabDiv.scrollTop=persistedScroll;
  48.         }
  49.     }
  50. }
  51.  
  52. function FixMac()
  53. {
  54.     for (var i=0;i<gaDivs.length;i++)
  55.     {
  56.         gaDivs[i].style.display="block";
  57.         gaDivs[i].style.visibility="visible";
  58.     }
  59. }
  60.  
  61. function tabToggle(tab)
  62. {
  63.     for (var i=0;i<gaDivs.length;i++)
  64.     {
  65.         if (gaDivs[i].tabName==tab.id)
  66.         {
  67.             tab.style.backgroundColor="";
  68.             tab.style.color="black"
  69.             gaDivs[i].style.display="block";
  70.             if (oBD.doesPersistence)
  71.             {
  72.                 expandoTabDiv.setAttribute("selectedTab",i);
  73.                 expandoTabDiv.save(gsStoreName);
  74.             }
  75.             var colRows=gaDivs[i].all.tags("TR");
  76.             if (gaDivs[i].offsetHeight<(expandoTabDiv.offsetHeight-20))        
  77.             {
  78.                 colRows(colRows.length-1).style.height=(expandoTabDiv.offsetHeight-gaDivs[i].offsetHeight+4);
  79.             }
  80.         }
  81.         else
  82.         {
  83.             var tabId=gaDivs[i].tabName;
  84.             var offTab=tblTabbed.all(tabId);
  85.             offTab.style.backgroundColor="#6699cc";
  86.             offTab.style.color="white";
  87.             gaDivs[i].style.display="none";
  88.         }
  89.     }
  90. }
  91.  
  92. function setColumnSizes()
  93. {
  94.     var maxWidth=0;
  95.     for (var i=0;i<gaDivs.length;i++)
  96.     {    
  97.         gaDivs[i].style.visibility="hidden";
  98.         gaDivs[i].style.display="block";
  99.         var colCells=gaDivs[i].all.tags("TD");
  100.         var width=colCells(0).offsetWidth;
  101.         if (width>maxWidth)
  102.         {
  103.             maxWidth=width
  104.         }
  105.     }
  106.     for (var i=0;i<gaDivs.length;i++)
  107.     {    
  108.         gaDivs[i].style.visibility="visible";
  109.         gaDivs[i].style.display="none";
  110.         var colCells=gaDivs[i].all.tags("TH");
  111.         colCells(0).style.pixelWidth=maxWidth;
  112.     }
  113. }
  114.  
  115. function tableScroll()
  116. {
  117.     if (oBD.doesPersistence)
  118.     {
  119.         expandoTabDiv.setAttribute("scroll",event.srcElement.scrollTop);
  120.         expandoTabDiv.save(gsStoreName);
  121.     }
  122. }
  123.  
  124. function insertDivOpen()
  125. {
  126.     var divElement='<DIV ID="expandoTabDiv" onScroll="tableScroll()" STYLE="scrollbar-base-color: #99ccff; BACKGROUND: #99ccff; POSITION: relative; top:-3px; BORDER-RIGHT: #99ccff 2px solid; BORDER-TOP: #99ccff 2px solid; PADDING-BOTTOM: 10px; OVERFLOW: auto; BORDER-LEFT: #99ccff 2px solid; WIDTH: 95&percent; BORDER-BOTTOM: #99ccff 2px solid; HEIGHT: 300px">'
  127.     document.write(divElement);
  128. }
  129.  
  130. function insertDivClose()
  131. {
  132.     var divElement='</DIV>'
  133.     document.write(divElement);
  134. }
  135.